import { createStore } from 'vuex';

export default createStore({
  state: {
    message: 'Hello Vuex'
  },
  mutations: {
    updateMessage(state, newMessage) {
      state.message = newMessage;
    }
  },
  actions: {
    setMessage({ commit }, message) {
      commit('updateMessage', message);
    }
  },
  getters: {
    message: state => state.message
  }
});
